{template 'header'}
<!--link rel="stylesheet" href="../addons/bsht_tbk/res/js/bootstrapSwitch.css">
<script src="../addons/bsht_tbk/res/js/bootstrap-switch.js"></script-->
<ul class="nav nav-tabs">
	<li><a href="{php echo $this->createWebUrl('listcaijiall_hdk');}" name="topbtn">采集库列表（未导入{$total2}条）</a></li>
</ul>
<style>
.table td span{display:inline-block;margin-top:4px;}
.table td input{margin-bottom:0;}
th{
	text-align: center !important;
}
td{
	text-align: center !important;
}
.red{color:red;font-weight:bold}
</style>
{if $op == 'display'}
<div class="main" style="padding-left:10px;padding-right:10px">

<div class="panel panel-info" style="padding-left:0px;padding-right:0px">
<div class="panel-heading">商品筛选（筛选结果：{$total}条）</div>
	<div class="panel-body">
		<form action="./index.php" method="get" class="form-horizontal" role="form">
			<input type="hidden" name="c" value="site" />
			<input type="hidden" name="a" value="entry" />
        	<input type="hidden" name="m" value="bsht_tbk" />
        	<input type="hidden" name="do" value="listcaijiall_hdk" />
			
			<div class="form-group">
                
<div class="form-group">
           <label class="col-xs-3 col-sm-3 col-md-5 col-lg-1 control-label">佣金低于</label>
				<div class="col-sm-3 col-lg-1">
					<input class="form-control" name="yjdy" id="" placeholder="" type="text" value="{$_GPC['yjdy']}">
				</div> 

           <label class="col-xs-3 col-sm-3 col-md-5 col-lg-1 control-label">收入低于</label>
				<div class="col-sm-3 col-lg-1">
					<input class="form-control" name="srdy" id="" placeholder="" type="text" value="{$_GPC['srdy']}">
				</div> 

           <label class="col-xs-3 col-sm-3 col-md-5 col-lg-1 control-label">售价低于</label>
				<div class="col-sm-3 col-lg-1">
					<input class="form-control" name="sjdy" id="" placeholder="" type="number" value="{$_GPC['sjdy']}">
				</div> 
		</div>



			  <label class="col-xs-3 col-sm-3 col-md-5 col-lg-1 control-label">关键字</label>
				<div class="col-sm-3 col-lg-3">
					<input class="form-control" name="keywords" id="" placeholder="例如服装中所有女装就输入“女”" type="text" value="{$_GPC['keywords']}">
				</div>

               <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">好单库分类</label>
					<div class="col-sm-8 col-lg-1">
						<select name="cate_id" class="form-control">
<option value="0" {if empty($_GPC['cate_id'])}selected="selected"{/if}>全部商品</option>
<option value="1" {if intval($_GPC['cate_id']) == 1}selected="selected"{/if}>1-女装</option>	
<option value="2" {if intval($_GPC['cate_id']) == 2}selected="selected"{/if}>2-男装</option>
<option value="3" {if intval($_GPC['cate_id']) == 3}selected="selected"{/if}>3-内衣</option>
<option value="4" {if intval($_GPC['cate_id']) == 4}selected="selected"{/if}>4-美妆</option>
<option value="5" {if intval($_GPC['cate_id']) == 5}selected="selected"{/if}>5-配饰</option>
<option value="6" {if intval($_GPC['cate_id']) == 6}selected="selected"{/if}>6-鞋品</option>
<option value="7" {if intval($_GPC['cate_id']) == 7}selected="selected"{/if}>7-箱包</option>
<option value="8" {if intval($_GPC['cate_id']) == 8}selected="selected"{/if}>8-儿童</option>
<option value="9" {if intval($_GPC['cate_id']) == 9}selected="selected"{/if}>9-母婴</option>
<option value="10" {if intval($_GPC['cate_id']) == 10}selected="selected"{/if}>10-居家</option>
<option value="11" {if intval($_GPC['cate_id']) == 11}selected="selected"{/if}>11-美食</option>
<option value="12" {if intval($_GPC['cate_id']) == 12}selected="selected"{/if}>12-数码</option>
<option value="13" {if intval($_GPC['cate_id']) == 13}selected="selected"{/if}>13-家电</option>
<option value="14" {if intval($_GPC['cate_id']) == 14}selected="selected"{/if}>14-其他</option>
						</select>
					</div>

                <label class="col-xs-2 col-sm-2 col-md-2 col-lg-1 control-label">分页显示量</label>
				<div class="col-sm-2 col-lg-1">
					<input class="form-control" name="psize" id="" placeholder="默认200个" type="text" value="{$_GPC['psize']}">
				</div>

				<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">缩略图</label>
					<div class="col-sm-8 col-lg-1">
						<select name="thumb" class="form-control">
			  <option value="0" {if intval($_GPC['thumb']) == 0}selected="selected"{/if}>显示</option>	
			  <option value="1" {if intval($_GPC['thumb']) == 1}selected="selected"{/if}>隐藏</option>
						</select>
					</div>

				<div class=" col-xs-12 col-sm-2 col-lg-1">
					<button class="btn btn-info"><i class="fa fa-search"></i> 筛 选</button>
				</div>
			</div>

 			<div class="form-group">
			</div>
		</form>
		
	</div>
</div>




<div class="panel panel-info" style="padding-left:0px;padding-right:0px">
<div class="panel-heading">采集条件</div>
<input type="hidden" id="jqnav" name="jqnav" value="1" />
<input type="hidden" id="jqcid" name="jqcid" value="0" />
<input type="hidden" id="jqsort" name="jqsort" value="0" />
<!--input type="hidden" id="jqnine" name="jqnine" value="0" /-->
<!--input type="hidden" id="jqthirty" name="jqthirty" value="0" /-->
<!--input type="hidden" id="jqnew_today" name="jqnew_today" value="0" /-->
<!--input type="hidden" id="jqtianmao" name="jqtianmao" value="0" /-->
<div class="panel-body">
<div class="library_select_list am-fl" id="library_select_list">
<!--ul增加 class="am-avg-sm-4 am-margin-0 am-padding-0"-->
                        <ul class="am-avg-sm-4 am-margin-0 am-padding-0"> 
							<!--li中的span增加 class="am-margin-right-xs"-->
                            <li style="list-style-type:none;">
								<span  class="am-margin-right-xs" >价格区间</span>
								<input type="number" id="itemendprice_min" name="itemendprice_min" value="" placeholder="￥" class="itemendprice_min">-<input type="number" id="itemendprice_max" name="itemendprice_max" placeholder="￥" value="" class="itemendprice_max">
							</li>
							
                            <li style="list-style-type:none;">
								<span  class="am-margin-right-xs" >销量区间</span>
								<input type="number" id="itemsale_min" name="itemsale_min" value="" class="itemsale_min">-<input type="number" id="itemsale_max" name="itemsale_max" value="" class="itemsale_max">
							</li>
                            <li style="list-style-type:none;">
								<span  class="am-margin-right-xs"  >佣金区间</span>
								<input type="number" id="tkmoney_min" name="tkmoney_min" value="" class="tkmoney_min">-<input type="number"  id="tkmoney_max" name="tkmoney_max" value="" class="tkmoney_max">
							</li>
							
							
                            <li style="list-style-type:none;">
							<span  class="am-margin-right-xs" >发布时间</span>
							<input type="number" id="starttime" name="starttime" value="7" class="starttime"> 天内</li>
                        </ul>
</div>
<a class="label label-sm label-success" href="javaScript:">板块：</a>
<a class="label label-sm label-info jqnav" href="javaScript:" nid="1">实时跑单</a>
<a class="label label-sm label-default jqnav" href="javaScript:" nid="4">券飙升榜</a>
<a class="label label-sm label-default jqnav" href="javaScript:" nid="2">人气宝贝</a>
<a class="label label-sm label-default jqnav" href="javaScript:" nid="3">全部商品</a>
<br>
<div style="height:5px"></div>
<a class="label label-sm label-success" href="JavaScript:">分类：</a>
<a class="label label-sm label-info jqcid" href="javaScript:" cid="0">全部商品</a>
<a class="label label-sm label-default jqcid" href="javaScript:" cid="1">女装</a>
<a class="label label-sm label-default jqcid" href="javaScript:" cid="2">男装</a>
<a class="label label-sm label-default jqcid" href="javaScript:" cid="3">内衣</a>
<a class="label label-sm label-default jqcid" href="javaScript:" cid="4">美妆</a>
<a class="label label-sm label-default jqcid" href="javaScript:" cid="5">配饰</a>
<a class="label label-sm label-default jqcid" href="javaScript:" cid="6">鞋品</a>
<a class="label label-sm label-default jqcid" href="javaScript:" cid="7">箱包</a>
<a class="label label-sm label-default jqcid" href="javaScript:" cid="8">儿童</a>
<a class="label label-sm label-default jqcid" href="javaScript:" cid="9">母婴</a>
<a class="label label-sm label-default jqcid" href="javaScript:" cid="10">居家</a>
<a class="label label-sm label-default jqcid" href="javaScript:" cid="11">美食</a>
<a class="label label-sm label-default jqcid" href="javaScript:" cid="12">数码</a>
<a class="label label-sm label-default jqcid" href="javaScript:" cid="13">电器</a>
<a class="label label-sm label-default jqcid" href="javaScript:" cid="14">其他</a>
<br>
<div style="height:5px"></div>
<a class="label label-sm label-success" href="JavaScript:">排序：</a>
<a class="label label-sm label-info jqsort" href="javaScript:" soid="0">默认综合</a>
<a class="label label-sm label-default jqsort" href="javaScript:" soid="1">优惠最多</a>    
<a class="label label-sm label-default jqsort" href="javaScript:" soid="2">销量最高</a>
<a class="label label-sm label-default jqsort" href="javaScript:" soid="3">佣金最高</a>
<a class="label label-sm label-default jqsort" href="javaScript:" soid="4">佣金比率最高</a>
<a class="label label-sm label-default jqsort" href="javaScript:" soid="5">券后价最低</a>
<br>
<div style="height:15px"></div>

<div style="width:auto;height:30px">
&nbsp;&nbsp;九块九包邮：<input type="checkbox" id="jqnine" name="jqnine" value="0"/>
&nbsp;&nbsp;30元封顶：<input type="checkbox" id="jqthirty" name="jqthirty" value="0"/>
&nbsp;&nbsp;今日上新：<input type="checkbox" id="jqnew_today" name="jqnew_today" value="0"/>
&nbsp;&nbsp;只选天猫：<input type="checkbox" id="jqtianmao" name="jqtianmao" value="0"/>
</div>

</div>
</div>



<div class="panel panel-info" style="padding-left:0px;padding-right:0px">
<div class="panel-heading">采集操作</div>
<div class="panel-body">
<a class="btn btn-sm btn-danger" href="javascript:importrow1({$row['id']})"><i class="fa fa-mail-forward"></i> 采集好单库产品</a>
<a  onclick="return confirm('该操作比较耗时，确认吗？'); return false;" href="{php echo $this->createWebUrl('listcaijiall_hdk',array('op'=>'adddtk'))}" class="btn btn-sm btn-warning ">一键导入已采集商品</a>
<a href="javascript:;" class="btn btn-sm btn-success mutadd">选择性批量添加到商品库</a>
&nbsp;&nbsp;&nbsp;&nbsp;
<a  onclick="return confirm('清空当前采集库，确认吗？'); return false;" href="{php echo $this->createWebUrl('itemallhdk_op',array('op'=>'delall_caiji'))}" class="btn btn btn-danger ">清空采集库</a>
&nbsp;
<a data-href="{php echo $this->createWebUrl('listcaijiall_hdk',array('op'=>'delall'))}" href="javascript:;" class="btn btn-danger mutdelete" id="delallbtn" name="delallbtn">删除选中</a>
<a href="#delallbtn" class="btn btn-sm btn-link">到底部↓↓↓</a>
</div>
</div>


</div>
<form action="" method="post" class="form-horizontal" role="form">
	<div style="padding:15px;background: white;">
		<table class="table table-hover">
			<thead class="navbar-inner">
				<tr>
				    <th style="width:3em;">
                        <input type="checkbox" id="checkall"/>
                    </th>
					<th style="width:100px;">序号</th>
					<th style="width:110px;text-align:center">售价</th>
					<th style="width:110px;text-align:center">佣金</th>
					<th style="width:110px;text-align:center">收入</th>
					<th style="width:110px;text-align:center">券后价</th>
					<th style="width:150px;text-align:center">所属分类</th>
					<th style="width:auto;text-align: left !important;">商品信息</th>
					{if $_GPC['thumb']==0 || empty($_GPC['thumb'])}
					<th style="width:150px">缩略图</th>
					{/if}
					<!--th style="width:100px">状态</th-->
					<th style="width:200px">修改/删除</th>
				</tr>
			</thead>
			<tbody>
				{loop $list $item}



{if $item['cate_id']==7456}{php $catename="未分类";}{/if}
{if $item['cate_id']==1}{php $catename="1-女装";}{/if}
{if $item['cate_id']==2}{php $catename="2-男装";}{/if}
{if $item['cate_id']==3}{php $catename="3-内衣";}{/if}
{if $item['cate_id']==4}{php $catename="4-美妆";}{/if}
{if $item['cate_id']==5}{php $catename="5-配饰";}{/if}
{if $item['cate_id']==6}{php $catename="6-鞋品";}{/if}
{if $item['cate_id']==7}{php $catename="7-箱包";}{/if}
{if $item['cate_id']==8}{php $catename="8-儿童";}{/if}
{if $item['cate_id']==9}{php $catename="9-母婴";}{/if}
{if $item['cate_id']==10}{php $catename="10-居家";}{/if}
{if $item['cate_id']==11}{php $catename="11-美食";}{/if}
{if $item['cate_id']==12}{php $catename="12-数码";}{/if}
{if $item['cate_id']==13}{php $catename="13-家电";}{/if}
{if $item['cate_id']==14}{php $catename="14-其他";}{/if}
				<tr>
				    <td><input type="checkbox" name="ids[]" value="{$item['id']}" style="font-size:10px"/></td>
					<td><input type="text" name="displayorder[{$item['id']}]" value="{$item['displayorder']}"  style="width:50px;font-size:10px;text-align: center;"></td>
					<td style="text-align:center"><label class="label label-success">￥{$item['itemfee']}</label></td>
					<td style="text-align:center"><label class="label label-success">{$item['shouru_bili']}%</label></td>
					<td style="text-align:center"><label class="label label-success">￥{$item['shouru_yongjin']}</label></td>
					<td style="text-align:center"><label class="label label-info">￥{$item['itemfee2']}</label></td>
					<td style="text-align:center"><label class="label label-success">{$catename}</label></td>
					<td style="text-align: left !important;width:100%;">
					名称：<label class="label label-success">{$item['itemid']}</label>&nbsp;{$item['title']}<br>
					<!--口令：{$item['itemtkl']}<br>-->
					链接：<input style="width:65%" type="text" value="{$item['itemsurl']}"><br>
					<!--长链：{$item['itemurl']}<br>-->
					{if $item['itemyhj_tit']!='无'}优惠卷：{$item['itemyhj_tit']}<br>
					<!--优惠卷-口令：{$item['itemyhj_tkl']}<br>-->
					<!--优惠卷-链接：{$item['itemyhj_url']}<br>-->{/if}
					</td>
                    {if $_GPC['thumb']==0 || empty($_GPC['thumb'])}
                    <td><img src="{php echo tomedia($item['itempic'])}" style="width:50px"></td>
					{/if}

					<!--td>{if $item['status']}<label class="label label-success status" data-id='{$item["id"]}'>启用</label>{else}<label class="label label-default status" data-id='{$item["id"]}'>禁用</label>{/if}</td-->
					
					<td>
						<!--a href="{php echo $this->createWebUrl('listall', array('op' => 'post', 'id' => $item['id']))}" title="编辑" class="btn btn-sm btn-default"><i class="fa fa-edit"></i></a-->
						<a onclick="return confirm('删除此商品，确认吗？'); return false;" href="{php echo $this->createWebUrl('listcaijiall_hdk', array('op' => 'del','id' => $item['id']))}" title="删除" class="btn btn-sm btn-danger"><i class="fa fa-remove"></i></a>
					</td>
				</tr>
				{/loop}

                <tr>
				    <th style="width:3em;">
                        <input type="checkbox" id="checkallbottom"/>
                    </th>
					
				</tr>

				<tr>
	                <td colspan="6" style="text-align: left !important;">
	                	<input name="token" type="hidden" value="{$_W['token']}" />
	                    <input type="submit" class="btn btn-primary" name="submit" value="提交排序" />

						<a data-href="{php echo $this->createWebUrl('listcaijiall_hdk',array('op'=>'delall'))}" href="javascript:;" class="btn btn-danger mutdelete" id="delallbtn" name="delallbtn">删除选中</a>

						<a href="javascript:;" class="btn btn-info mutadd">批量添加到商品库</a>

						<a href="#topbtn" class="btn btn-sm btn-link">到顶部↑↑↑</a>
	                </td>
	            </tr>


			</tbody>
			
		</table>
		{$pager}
	</div>
</form>
</div>
<style>
	.masklayer{ display: none; width: 100%; height: 100%; position: fixed; z-index: 1000; top: 0px; left: 0px; background: rgba(0,0,0,0.7);}
	.mask{ display: none; width: 460px; height: auto; overflow: hidden; position: fixed; z-index: 2000; left: 50%; margin-left: -230px; background: #fff; top: 20%;}
	.mask .title{ width: 100%; height: 40px; line-height: 40px; background:#467ab3; position: relative; z-index: 10;}
	.mask .title span{ margin-left: 15px; color: #fff; font-size: 14px;}
	.mask .title .close{ width: 40px; height: 40px; position: absolute; display: block; top: 7px; right: -15px;color:#fff; z-index: 20;}
	.maskMain{  padding: 0px; height: auto; overflow: hidden; text-align: center; padding-bottom: 30px;}
	.maskMain a{ width: 40%; height: 46px; line-height: 46px; text-align: center; display: inline-block; background: #467ab3; color: #fff; border: 1px solid #000; margin: 30px 15px 0px 15px;}
</style>
<div class="masklayer" onclick="javascript:close1();" style="display: none;" id="masklayer1"></div>
<div class="mask maskOuter" style="display: none;" id="mask1">
			<p class="title">
				<span>采集好单库商品</span>
				<em class="close" onclick="javascript:close1();">X</em>
			</p>
			
			<div class="maskMain">
				<input type="text" id="page1" name="page1" value="1"/> 输入开始页码(默认第1页)
				<input type="text" id="pageend1" name="pageend1" value="1"/> 输入结束页码(默认第1页)
                 <button class="btn btn-info" style="margin-left:5%;margin-top:20px;" onclick="importall_hdk1()">确认读取（每页120条）</button>
			</div>
</div>






<div id="modal-module-menus-cheat"  class="modal fade" tabindex="-1">
        <div class="modal-dialog" style='width: 520px;'>
            <div class="modal-content">
                <div class="modal-header" style="height:50px"><button aria-hidden="true" data-dismiss="modal" class="close" type="button">×</button><h4>提示：即将导入
<font color="red">（共{$total}条）</font>已选商品到下列分类
				
				
				
				</h4></div>
                <div class="modal-body">
                  
				   {loop $cate $i}
				   <a data-id="{$i['id']}" data-href="{php echo $this->createWebUrl('listcaijiall_hdk',array('op'=>'addall'))}" href="javascript:;" class="btn btn-info mutaddok" style="margin:5px 5px;">{$i['name']}</a>
                   {/loop}
				   
				
				   <!--a data-id="{$i['id']}" data-href="{php echo $this->createWebUrl('listcaijiall_dtk',array('op'=>'addall'))}" href="javascript:;" class="btn btn-info mutaddok" style="margin:5px 5px;">点击确认添加</a-->
               

                </div>
            </div>
        </div>
</div>

<script>
function drop_confirm(msg, url){
            if (confirm(msg)){
            window.location = url;
            }
            }


function importall_hdk1(){
	var page1 = $('#page1').val();
	var pageend1 = $('#pageend1').val();
	var pageend1 = $('#pageend1').val();
	var itemendprice_min = $('#itemendprice_min').val();
	var itemendprice_max = $('#itemendprice_max').val();
	var itemsale_min = $('#itemsale_min').val();
	var itemsale_max = $('#itemsale_max').val();
	var tkmoney_min = $('#tkmoney_min').val();
	var tkmoney_max = $('#tkmoney_max').val();
	var jqnav = $('#jqnav').val();
	var jqcid = $('#jqcid').val();
	var jqsort = $('#jqsort').val();
	var jqnine = $('#jqnine').val();
	var jqthirty = $('#jqthirty').val();
	var jqnew_today = $('#jqnew_today').val();
	var jqtianmao = $('#jqtianmao').val();
	var starttime = $('#starttime').val();

var hdkurl = './index.php?c=site&a=entry&do=importall_hdk1&m=bsht_tbk&page1='+page1+'&pageend1='+pageend1+'&itemendprice_min='+itemendprice_min+'&itemendprice_max='+itemendprice_max+'&itemsale_min='+itemsale_min+'&itemsale_max='+itemsale_max+'&tkmoney_min='+tkmoney_min+'&tkmoney_max='+tkmoney_max+'&starttime='+starttime+'&jqnav='+jqnav+'&jqcid='+jqcid+'&jqsort='+jqsort+'&jqnine='+jqnine+'&jqthirty='+jqthirty+'&jqnew_today='+jqnew_today+'&jqtianmao='+jqtianmao;

//alert(hdkurl);


	drop_confirm('确认开始采集第'+page1+'页到第'+pageend1+'页数据？', hdkurl);
}


function importrow1(rowid){
	$('#rowid').val(rowid);
	$("#mask1").fadeIn(500);
	$("#masklayer1").fadeIn(500);
}
function importrow2(rowid){
	$('#rowid').val(rowid);
	$("#mask2").fadeIn(500);
	$("#masklayer2").fadeIn(500);
}
function importrow3(rowid){
	$('#rowid').val(rowid);
	$("#mask3").fadeIn(500);
	$("#masklayer3").fadeIn(500);
}
function importrow4(rowid){
	$('#rowid').val(rowid);
	$("#mask4").fadeIn(500);
	$("#masklayer4").fadeIn(500);
}
function close1(){
	$(".maskOuter").fadeOut(500);
	$(".masklayer").fadeOut(500);
}
</script>
<script>
require(['util'],function(util){
$('.mutdelete').click(function(){
            var url = $(this).data('href');
            var ids = [];
            var idss = [];
            $('input:checkbox[name="ids[]"]').each(function() {
                var _that = $(this)[0];
                if(_that.checked){
                    ids = ids.concat($(this).val());
                }else{
                    idss = idss.concat($(this).val());
                }
            });
            console.log(ids);
            if(confirm("您确定要删除么？")){
                $.post(url,{ids:ids},function(data){
                    util.message("删除成功","{php echo $_W['siteurl']}",'success');
                },'json');
            }
        });


$('.mutadd').click(function(){

$('#modal-module-menus-cheat').modal();

});

$('.mutaddok').click(function(){
            var url = $(this).data('href');
            var ids = [];
            var idss = [];
			var cateid = $(this).data('id');
            $('input:checkbox[name="ids[]"]').each(function() {
                var _that = $(this)[0];
                if(_that.checked){
                    ids = ids.concat($(this).val());
                }else{
                    idss = idss.concat($(this).val());
                }
            });
			
            console.log(cateid);
            if(confirm("您确定要导入么？")){
                $.post(url,{ids:ids,cateid:cateid},function(data){
                    util.message("导入成功","{php echo $_W['siteurl']}",'success');
                },'json');
            }
        });


});

$("#checkall").click(function(){
            console.log('checkall');
            $('input[name="ids[]"').each(function(){
                var _that = $(this)[0];
                if(_that.checked){
                    _that.checked = false;
                }else{
                    _that.checked = true;
                }
            });
        });


$("#checkallbottom").click(function(){
            $("#checkall").click();
        });


$('.status').click(function(){
	var label = $(this);
	$.ajax({
		url:'{php echo $this->createWebUrl("listall",array("op"=>"status"))}',
		type:'post',
		data:{id:label.attr('data-id')},
		success:function(status){
			if(status == '1'){
				if(label.hasClass('label-success')){
					label.removeClass('label-success').addClass('label-default');
					label.text('禁用');
				}else{
					label.removeClass('label-default').addClass('label-success');
					label.text('启用');
				}
			}
		}
	});
});



$('.jqnav').click(function(){
	var label = $(this);
	var nid = label.attr('nid');
    $('.jqnav').removeClass('label-info').addClass('label-default');
	label.removeClass('label-default').addClass('label-info');
	$('#jqnav').val(nid);
	var jqnav = $('#jqnav').val();
	//alert(jqnav);
});


$('.jqcid').click(function(){
	var label = $(this);
	var cid = label.attr('cid');
    $('.jqcid').removeClass('label-info').addClass('label-default');
	label.removeClass('label-default').addClass('label-info');
	$('#jqcid').val(cid);
	var jqcid = $('#jqcid').val();
	//alert(jqcid);
});

$('.jqsort').click(function(){
	var label = $(this);
	var soid = label.attr('soid');
    $('.jqsort').removeClass('label-info').addClass('label-default');
	label.removeClass('label-default').addClass('label-info');
	$('#jqsort').val(soid);
	var jqsort = $('#jqsort').val();
	//alert(jqsort);
});


</script>

<script type="text/javascript">
	require(['jquery.ui', 'bootstrap.switch'], function($){

		$(":checkbox[name='jqnine']").bootstrapSwitch();
		$(":checkbox[name='jqnine']").on('switchChange.bootstrapSwitch', function(e, state){
			$this = $(this);
			var ninestatus = this.checked ? 1 : 0;
			//
			$('#jqnine').val(ninestatus);
			var jqnine = $('#jqnine').val();
			//alert(jqnine);
			//
		});

		$(":checkbox[name='jqthirty']").bootstrapSwitch();
		$(":checkbox[name='jqthirty']").on('switchChange.bootstrapSwitch', function(e, state){
			$this = $(this);
			var thirtystatus = this.checked ? 1 : 0;
			//
			$('#jqthirty').val(thirtystatus);
			var jqthirty = $('#jqthirty').val();
			//alert(jqthirty);
			//
		});

        $(":checkbox[name='jqnew_today']").bootstrapSwitch();
		$(":checkbox[name='jqnew_today']").on('switchChange.bootstrapSwitch', function(e, state){
			$this = $(this);
			var new_todaystatus = this.checked ? 1 : 0;
			//
			$('#jqnew_today').val(new_todaystatus);
			var jqnew_today = $('#jqnew_today').val();
			//alert(jqnew_today);
			//
		});

		$(":checkbox[name='jqtianmao']").bootstrapSwitch();
		$(":checkbox[name='jqtianmao']").on('switchChange.bootstrapSwitch', function(e, state){
			$this = $(this);
			var tianmaostatus = this.checked ? 1 : 0;
			//
			$('#jqtianmao').val(tianmaostatus);
			var jqtianmao = $('#jqtianmao').val();
			//alert(jqtianmao);
			//
		});

		$('.bootstrap-switch-handle-on').html('开启');
        $('.bootstrap-switch-handle-off').html('关闭');

	});
</script>



{elseif $op == 'post'}
<div class="panel panel-info">
		<div class="panel-body">
			<form action="" method="post" class="form-horizontal" role="form">
			<input type="hidden" name="id" value="{$item[id]}">
			<div class="form-group">
				<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">商品名称</label>
				<div class="col-sm-4">
					<input class="form-control" required="required" name="title" type="text" value="{$item['title']}">
				</div>
			</div>
			<div class="form-group">
				<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">排序</label>
				<div class="col-sm-4">
					<input class="form-control" name="displayorder" type="number" min="0" value="{$item['displayorder']}">
				</div>
			</div>
			<div class="form-group">
				<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">状态</label>
				<div class="col-sm-4">
					<label><input type="radio" name="status" checked="checked" value="0"> 禁用</label>
					<label style="margin-left: 10px;"><input type="radio" name="status" {if $item['status']}checked="checked"{/if} value="1"> 启用</label>
				</div>
			</div>
			<button type="submit" class="btn btn-primary" name="submit" value="提交">保存</button>
			<input type="hidden" name="token" value="{$_W['token']}" />
			</form>
	</div>
</div>
{/if}


{template 'footer'}
